import { limitCall } from './util/util'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import { store } from './store/index'
import './plugins/iview.js'
import './plugins/filter'
import './plugins/animate'
import './plugins/transition'

import {
  createProvider,
  VueApollo,
  DollarApollo
  //@ts-ignore
} from './vue-apollo'
import { gqlErrorHandler, networkErrorHandler } from './util/errorHandler'

Vue.config.productionTip = false
declare module 'vue/types/vue' {
  interface Vue {
    apolloProvider: VueApollo
    $apollo: DollarApollo<any>
  }
}

let vm = new Vue({
  router,
  store,
  //@ts-ignore
  apolloProvider: createProvider(
    {},
    (err: Error) => {
      networkErrorHandler(vm, err)
    },
    (err: any) => gqlErrorHandler(vm, err)
  ),
  render: h => h(App)
}).$mount('#app')
